package cn.hsa.xxx.bookData.dto;

import cn.hsa.xxx.api.dto.ShelvesApprovalProcessDTO;
import cn.hsa.xxx.bookData.entity.ShelvesApprovalProcessDO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;


@Component
public class ShelvesApprovalProcessDTOConverter {

    /**
     * Convert ShelvesApprovalProcessDTO to ShelvesApprovalProcessDO
     *
     * @param shelvesApprovalProcessDTO
     * @return
     */
    public ShelvesApprovalProcessDO convertToShelvesApprovalProcessDO(ShelvesApprovalProcessDTO shelvesApprovalProcessDTO) {
        if (shelvesApprovalProcessDTO == null) {
            return null;
        }
        ShelvesApprovalProcessDO shelvesApprovalProcessDO = new ShelvesApprovalProcessDO();

        //ShelvesApprovalProcessDO.setId(ShelvesApprovalProcessDTO.getId());
        //ShelvesApprovalProcessDO.setName(ShelvesApprovalProcessDTO.getName());
        //ShelvesApprovalProcessDO.setSex(ShelvesApprovalProcessDTO.getSex());
        //ShelvesApprovalProcessDO.setAddr(ShelvesApprovalProcessDTO.getAddr());

        //性能略差，但使用方便
        BeanUtils.copyProperties(shelvesApprovalProcessDTO, shelvesApprovalProcessDO);

        return shelvesApprovalProcessDO;
    }

    /**
     * Convert ShelvesApprovalProcessDO to ShelvesApprovalProcessDTO
     *
     * @param shelvesApprovalProcessDO
     * @return
     */
    public ShelvesApprovalProcessDTO convertToShelvesApprovalProcessDTO(ShelvesApprovalProcessDO shelvesApprovalProcessDO) {
        if (shelvesApprovalProcessDO == null) {
            return null;
        }

        ShelvesApprovalProcessDTO shelvesApprovalProcessDTO = new ShelvesApprovalProcessDTO();

        //ShelvesApprovalProcessDTO.setId(ShelvesApprovalProcessDO.getId());
        //ShelvesApprovalProcessDTO.setName(ShelvesApprovalProcessDO.getName());
        //ShelvesApprovalProcessDTO.setSex(ShelvesApprovalProcessDO.getSex());
        //ShelvesApprovalProcessDTO.setAddr(ShelvesApprovalProcessDO.getAddr());

        //性能略差，但使用方便
        BeanUtils.copyProperties(shelvesApprovalProcessDO, shelvesApprovalProcessDTO);

        return shelvesApprovalProcessDTO;
    }
}
